/*
 * @Author: tomystery 
 * @Date: 2018-05-14 14:30:52 
 * @Last Modified by: t
 * @Last Modified time: 2018-05-15 15:48:17
 */
import MUtil from 'util/mm.jsx'
const _mm = new MUtil()
class User {
    //用户登陆
    login(loginInfo) {
        return _mm.request({
            type: 'post',
            url: '/manage/user/login.do',
            data: loginInfo
        })
    }
    //用户推出登陆
    logout() {
        return _mm.request({
            type: 'post',
            url: '/user/logout.do'
        })
    }
    //检查登陆接口的数据是不是合法
    checkLoginInfo(loginInfo) {
        let username = $.trim(loginInfo.username)
        let password = $.trim(loginInfo.password)

        if (typeof username != 'string' || username.length === 0) {
            return {
                status: false,
                msg: '用户名不能为空!'
            }
        }

        if (typeof password != 'string' || password.length === 0) {
            return {
                status: false,
                msg: '密码不能为空！'

            }
        }

        return {
            status: true,
            msg: '验证成功!'
        }

    }
    getUserList(pageNum) {
        return _mm.request({
            type: 'post',
            url: '/manage/user/list.do',
            data: {
                pageNum: pageNum
            }
        })
    }

}
export default User